package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.Date;
@Getter@Setter
public class StrategyComment extends BaseDomain{
    public static final Integer STATE_COMMON = 0;
    public static final Integer STATE_HOT = 1;
    public static final Integer STATE_DISABLE = -1;

    private User author;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    private String content;

    private String imgUrls;

    private Integer starNum;

    private Strategy strategy;

    private Integer state = STATE_COMMON;

    private Date commendTime;

    //攻略评论的数量
    private Long strategyCommentNum;

    public String[] getImgArr(){
        if (StringUtils.hasLength(imgUrls)) {
            String[] strings = imgUrls.split(";");
            return strings;
        }
        return null;
    }
}